package org.proddevplm.business.activity;

import java.util.HashMap;
import java.util.Map;

import org.proddevplm.business.activity.constants.ActivityConstants;
import org.proddevplm.business.api.IAdapter;
import org.proddevplm.helpers.ManagerUtil;

public class ActivityAdapter implements IAdapter{

	@Override
	public Object adapt(int command, Map<String, Object> dataObject) {
		Object adaptedObject = null;
		Map<String, Object> activityMap = new HashMap<String, Object>();
		
		switch(command){
		
		case ActivityConstants.UPDATE_ACTIVITY:
			activityMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = activityMap;
			break;
			
		case ActivityConstants.CHANGE_STATUS:
			activityMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = activityMap;
			break;
			
		case ActivityConstants.ADD_COMMENT:
			activityMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			activityMap.put("comment", ManagerUtil.getStringFromReq(dataObject.get("comment")));
			adaptedObject = activityMap;
			break;
			
		case ActivityConstants.REMOVE_ACTIVITY:
			activityMap.put("activityName", ManagerUtil.getStringFromReq(dataObject.get("activityName")));
			adaptedObject = activityMap;
			break;
		}
		return adaptedObject;
	}

}
